//
//  BaseViewController.h
//  OrderSeat
//
//  Created by wangwei on 13-10-9.
//  Copyright (c) 2013年 wangwei. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "EGORefreshTableHeaderView.h"

#define BACK_BUTTON_TITLE     @"返回"
#define NAV_BACKGROUND        @"navbar_bg.png"
#define NAV_BUTTON_BACKGROUND @"nav_btn_bg.png"
#define NAV_SEARCH_BACKGROUND @"nav_btn_search_n.png"
#define NAV_CLOSS_BACKGROUND  @"nav_closs_n"

@interface BaseViewController : UIViewController<UIScrollViewDelegate,EGORefreshTableDelegate>

@property (assign, nonatomic) BOOL isLoaded;
@property (assign, nonatomic) BOOL reloading;
@property (strong, nonatomic) UITableView *contentTable;
@property (strong, nonatomic) EGORefreshTableHeaderView *refreshHeaderView;

@property (strong, nonatomic) NSMutableDictionary *data;
@property (strong, nonatomic) NSMutableDictionary *controls;
@property (strong, nonatomic) UIViewController *parentController;
@property (assign, nonatomic) BOOL isBack;
@property (assign, nonatomic) BOOL moreLoading;

- (void)reset;
- (id)initWithNibClass:(Class)_class;
- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle;
- (void)setNavigationTitle:(NSString*)title;
- (void)createNavigation:(NSString*)title;
- (void)createLeftButton;
- (void)createRightButton;
- (void)createRightButton:(NSString*)title;
- (void)createRightButtonWithFrame:(CGRect)rect;
- (void)createRightButtonWithFrame:(CGRect)rect background:(NSString*)background;
- (void)createLeftButtonWithTitle:(NSString*)title background:(NSString*)background frame:(CGRect)rect;
- (void)createRightButtonWithTitle:(NSString*)title background:(NSString*)background;
- (void)createRightButtonWithTitle:(NSString*)title background:(NSString*)background frame:(CGRect)rect;

- (id)createCellWithNib:(NSString*)nib;
- (id)createCellWithNib:(NSString*)nib tableview:(UITableView*)tableview;

- (void)pushViewController:(UIViewController *)viewController;
- (void)popToViewController:(UIViewController *)viewController;
- (void)pushOrPopViewController:(Class)_class;
- (BOOL)findController:(UIViewController*)viewController;
- (BOOL)existsControllerWithClass:(Class)_class;
- (UIViewController*)findControllerWithClass:(Class)_class;

- (void)addControl:(id)contr forKey:(NSString *)key;
- (void)addControl:(id)contr value:(id)value forKey:(NSString *)key;


- (void)autoPullRefresh;
-(void)doPullRefresh;
-(void)createHeaderViewForTable:(UITableView *)tableview;
-(void)beginToReloadData:(EGORefreshPos)aRefreshPos;
-(void)refreshView;
-(void)finishedLoadData;
- (void)finishReloadingData;

@end
